﻿using AutoRegistDependency.Attributes;
using Core.Framework.Interceptors.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;

namespace Core.Framework.Interceptors.Attributes
{
    /// <summary>
    /// 事务特性 如果当前类被代理，标记此特性可实现声明式事务
    /// </summary>
    [AttributeUsage(AttributeTargets.Class| AttributeTargets.Method,AllowMultiple =false,Inherited =false)]
    public class TransactionalAttribute : Attribute
    {
        /// <summary>
        /// 事务传播类型
        /// </summary>
        public Propagation Propagation { get; set; } = Propagation.Required;
        /// <summary>
        /// 事务隔离级别
        /// </summary>
        public IsolationLevel IsolationLevel { get; set; }=IsolationLevel.ReadCommitted;
        /// <summary>
        /// 事务回滚异常类型
        /// </summary>
        public Type RollBackFor { get; set; } = typeof(Exception);
    }
}
